// index.js
const MapTileManager = require('./MapTileManager');
const GoogleTileSystem = require('./GoogleTileSystem');

async function main() {
    // 定义输入截图目录和输出切片目录
    const screenshotsDir = '/Users/laotie/Library/Application Support/labelmap/captures/20250207_085926';
    const outputDir = '/Users/laotie/Library/Application Support/labelmap/tiles';

    // 初始化切片系统
    const tileSystem = new GoogleTileSystem();

    // 创建 MapTileManager 实例
    const processor = new MapTileManager(tileSystem);

    // 加载截图
    const screenshots = await processor.loadScreenshots(screenshotsDir);

    if (screenshots.length === 0) {
        console.log('未找到有效的截图和元数据文件，退出。');
        return;
    }

    // 批量处理截图
    await processor.batchProcess(screenshots, outputDir);
}

main().catch((err) => {
    console.error('处理过程中发生错误:', err);
});
